<?php

$state = $_GET['state'];
if ($state == "initial") {
//    echo "{list:{title:'Our First List',list_id:'1',items: [{id:'s', label:'Sign Up'},{id:'l', label:'Login'}]}}";
    echo "{list:{title:'Our First List',list_id:'lt1',items: [{id:'1', label:'Sign Up'},{id:'2', label:'Login'}]}}";
} else if ($state == "select") {
    $sid = $_GET['sid'];
    if ($sid == "1") {
        echo "{form:{
            title:'Fill this form',
            form_id:'fm1',
            items:[
                {textfield:{id:'tx1', label:'Enter Username'}},
                {textfield:{id:'tx2',label:'Enter Password'}},
                {textfield:{id:'tx2',label:'Re-enter Password'}}
               ] }}";
    }
}
else if($state == "submit"){
    echo "{pay:{amount:100}}";
}